KitePlayerPictureInPicture

Shows the picture of a KitePlayerAwtView in a small window that stays above every other window.

The JVM has no system picture in picture, so this opens a borderless always-on-top window and moves the view's renderer into it. The renderer moves, not the view: no decoder restarts, a paused picture is painted again as soon as the window has its size, and subtitles come along because the renderer draws them. stop hands the renderer back to the view.

In the window, a click plays or pauses, a double click returns to the app, a drag moves the window, and a drag from its lower right corner resizes it and keeps its aspect. A right click opens a menu with play or pause, "Back to app" and "Close", or the FloatingWindowLabels passed in the options. The window has no drawn buttons, because nothing Swing draws can appear above a native canvas.

All members must be used from the AWT event dispatch thread, like the view itself.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val active: StateFlow<Boolean>

isActive, as a flow that changes when the window opens and when it closes.

Link copied to clipboard

True while the floating window is on screen.

Link copied to clipboard

True until close. createOrNull already checked that this JVM can open the window.

Link copied to clipboard

Called for a double click or "Back to app" in the window, in place of the default. The default, used while this is null, calls stop and brings the view's own window to the front.

Functions

Link copied to clipboard
open override fun close()

Calls stop, then refuses every later start.

Link copied to clipboard
fun start()

Opens the window on the screen that shows the view, in the corner FloatingWindowOptions names, and moves the picture into it. Does nothing while the window is open, while another floating window shows the same view, or after close.

Link copied to clipboard
fun stop()

Closes the window and hands the picture back to the view. Does nothing when it is not open.